<layout
  th:replace="~{views/layout :: layout (
  page = 'archives',
  title = ${site.title} + ' - ' + '归档',
  pin = ~{::pin},
  header = ~{::header},
  main = ~{::main}
  )}"
>
  <!--/* pin */-->
  <th:block th:fragment="pin">
    <script id="pageScript" th:inline="javascript">
      window.MainApp.data =  /*[[${postFinder.archives(1,archives.total).items}]]*/ [];

      Object.assign(window.MainApp.conf, {
        //第一屏
        enable_above: /*[[${theme.config.archives.enable_above}]]*/ '',
        above_background: /*[[${theme.config.archives.above_background}]]*/ '',
        // 分页
        nextUrl: /*[[${archives.nextUrl}]]*/ {},
        prevUrl: /*[[${archives.prevUrl}]]*/ {},
        page: /*[[${archives.page}]]*/ {},
        size: /*[[${archives.size}]]*/ {},
        total: /*[[${archives.total}]]*/ {},
        totalPages: /*[[${archives.totalPages}]]*/ {},
        hasPrevious: /*[[${archives.hasPrevious()}]]*/ {},
        hasNext: /*[[${archives.hasNext()}]]*/ {},
      });
    </script>
  </th:block>

  <!--/* header */-->
  <th:block th:fragment="header">
    <header th:class="${not theme.config.archives.enable_above ? 'header dp' : 'header'}">
      <!--/* 导航栏 */-->
      <th:block th:replace="~{views/nav}"/>

      <!--第一屏内容-->
      <section class="above" th:if="${theme.config.archives.enable_above}">
        <div class="above-info">
          <h1 class="above-title">归档</h1>
        </div>
      </section>
    </header>
  </th:block>


  <!--/* 內容 */-->
  <th:block th:fragment="main">
    <section class="content card" th:with="noData = ${not #lists.isEmpty(archives.items)}">

      <th:block th:if="${noData}">
        <div class="chart"></div>

        <div class="axis-title" th:text="'文章总览 - '+${archives.total}"></div>

        <ul class="axis-list">
          <th:block th:each="archive : ${archives.items}">
            <li class="axis-list--item  year">
              <span class="name" th:text="${archive.year}"></span>
            </li>

            <th:block th:each="months : ${archive.months}">
              <li class="axis-list--item "
                  th:each="post : ${months.posts}">

                <a class="cover" th:href="${post.status.permalink}">
                  <img th:replace="~{views/components:: lazyLoadImg(${post.spec.cover},${post.spec.title},'img',true,${param_prefix +'v=' + #dates.format(post.spec.publishTime, 'yyyyMMddhhmmss')})}"/>
                </a>

                <div class="info">
                  <time th:text="'发布于 '+${#dates.format(post.spec.publishTime, 'yyyy-MM-dd HH:mm')}"></time>

                  <a class="title" th:href="${post.status.permalink}" th:text="${post.spec.title}"></a>
                </div>

              </li>

            </th:block>
          </th:block>
        </ul>

      </th:block>

      <th:block th:unless="${noData}" th:insert="~{views/components:: emptyData(false)}"></th:block>
    </section>
    <th:block th:replace="~{views/aside::common}"/>
  </th:block>

</layout>